package com.library.contorller;


import com.library.bean.Admin;
import com.library.service.AdminImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class AdminServlet {

    @Autowired
    AdminImpl adminImpl;


    @RequestMapping("/selectAdminOrUserByUsernameAndPassword")
    @ResponseBody
    public String selectAdminOrUserByUsernameAndPassword(@RequestBody Admin admin) {
        Admin admin1 = adminImpl.selectAdminOrUserByUsernameAndPassword(admin);
        if (admin1 == null) {
            return  "{'stateCode':'0'}";
        }
        return  "{'stateCode':'1'}";

    }


}
